#include "FSA.h"


FSA::FSA()
{
	currentState = 255;
	table = NULL;
}

FSA::FSA(unsigned char** t, unsigned char initialState)
{
	table = t;
	currentState = initialState;
}

void FSA::transition(unsigned char input)
{
	unsigned char i = input;
	unsigned char j = currentState;
	unsigned char next = table[i][j];
	currentState = next;
}

unsigned char FSA::peek(unsigned char input)
{
	return table[input][currentState];
}

unsigned char FSA::getState()
{
	return currentState;
}

